#include <iostream>
using namespace std;

void Portion(int arr[], const int length, const int comb) {
    const int temp = arr[0];
    int i = 0, j = length - 1;
    while (i < j) {
        while (i<j && arr[j] >= comb) {
            j--;
        }
        if (arr[j] < comb) {
            arr[i++] = arr[j];
        }
        while (i<j && arr[i] <= comb) {
            i++;
        }
        if (arr[i] >= comb) {
            arr[j--] = arr[i];
        }
    }
    arr[i] = temp;
}

int main() {
    int arr[] = {2,1,-7,-3,5,6,-1};
    constexpr int length = size(arr);
    constexpr int comb = 3;
    Portion(arr,length,comb);
    for (int i=0;i<size(arr);i++) {
        cout << "arr[" << i << "] = " << arr[i] << "\n";
    }
    cout << endl;
    return 0;
}